home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / vbasic / diskinfo.zip / DISKINFO.TXT < prev    next >
Text File  |  1994-01-06  |  3KB  |  73 lines

  1. DISKINFO.DLL
  2.  
  3. This DLL is provided as a service to all VB users who may find it
  4. useful.  If you choose to use this DLL then you do so at your own
  5. risk, however, I have been using it constantly in all my VB3 apps
  6. and have never had a problem so far.
  7.  
  8. This DLL will work with Visual Basic.
  9. This DLL is the compiled version of the DLL found in the help file 
  10. article Q106553 (refer to this article for more info).
  11.  
  12. There is an error in the code found in the help file.  I have modified
  13. the code to correct that error.  The line of code in question is:
  14.  
  15.     *ulFreeSpace - (unsigned long) driveinfo.avail_clusters ...etc
  16.  
  17. The first minus sign should have been an equal sign as such:
  18.  
  19.     *ulFreeSpace = (unsigned long) ...etc
  20.  
  21. This DLL was compiled using MSVC++ 1.0
  22.  
  23. This DLL will return the free disk space of the current drive.  If you
  24. require to know the free disk space of a drive which is not the current
  25. drive then you must change drives using the VB commands CurDir and ChDrive.
  26. If you save the current drive before you change drives you can use these 
  27. commands to ensure that you return to the desired drive before you exit
  28. the procedure that called this sub.
  29.  
  30. Assuming you have installed the DLL into the Windows\System directory,
  31. the declaration for the sub is such (type all on one line):
  32.  
  33.   Declare Sub GetDiskInfo lib "diskinfo.dll" (ByVal mydrive$, 
  34.       ByVal myvolume$, free&)
  35.  
  36. Notice that there is no 'ByVal' used with free.
  37.  
  38. Here is an example of calling the DLL:
  39.  
  40. Sub cmdDiskSpace_ Click()
  41.   Dim drive As String * 1
  42.   Dim volume As String * 20
  43.   Dim free&
  44.   Call GetDiskInfo(drive, volume, free&)
  45. End Sub 
  46.  
  47. Within the sub you could add code to use the returned variables as required.
  48.  
  49.     'drive' will return the current drive.
  50.  
  51.     'volume' will return the volume of the drive.
  52.  
  53.     'free' will return the available free disk space.
  54.  
  55. What you must take into consideration when using 'free' is that the 
  56. DLL returns an unsigned long, which is not available within VB.  
  57. Therefore, if the free disk space is larger than the VB maximum size
  58. for a long (2,147,483,647) it will return a negative value.  For example,
  59. this code seems to check for free disk space over 100000:
  60.  
  61.     If free > 100000 Then
  62.     ...etc
  63.     End If
  64.  
  65. This code will take into consideration the negative values:
  66.  
  67.     If free < 0 And free > 100000 Then
  68.         ...etc
  69.     End If
  70.  
  71. This DLL is submitted by Douglas Marquardt, 72253,3113
  72. A more detailed explanation can be found in the KB article Q106553.
  73.